package com.fly.server.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.fly.server.domain.User;
import com.fly.server.mapper.UserMapper;
import com.fly.server.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName UserServiceImpl
 * @Description TODO
 * @Author Fly
 * @Version
 * @Date 2019-12-26 0026 10:00
 */
@Service
public class UserServiceImpl implements UserService {

    private final UserMapper userMapper;

    public UserServiceImpl(UserMapper userMapper) {
        this.userMapper = userMapper;
    }

    /**
     * 保存
     *
     * @param user
     * @return
     */
    @Override
    public void saveUser(User user) {
        userMapper.insert(user);
    }

    /**
     * 删除
     *
     * @param id
     */
    @Override
    public void removeUser(String id) {
        userMapper.deleteById(id);
    }

    /**
     * 查找
     */
    @Override
    public List<User> selectList() {
        return userMapper.selectList(Wrappers.emptyWrapper());
    }
}
